package LoginFrame;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class LoginFrame extends JFrame {

    private JLabel welcomeLabel;
    private JButton okButton;

    public LoginFrame() {
        setTitle("登录界面");
        setSize(300, 200);
        setLayout(null);

        okButton = new JButton("OK");
        okButton.setBounds(100, 70, 100, 30);
        add(okButton);

        welcomeLabel = new JLabel("欢迎参加Java考试");
        welcomeLabel.setBounds(100, 30, 120, 30);
        welcomeLabel.setVisible(false); // 初始时隐藏
        add(welcomeLabel);

        okButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                welcomeLabel.setVisible(true);
            }
        });

        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);
    }

    public static void main(String[] args) {
                new LoginFrame();
            }
}